<?php

use yii\db\Migration;

class m240417_014729_diandi_tea_hourse extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%diandi_tea_hourse}}', [
            'id' => "int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '包间id'",
            'bloc_id' => "int(11) NULL COMMENT '人脸库组id'",
            'store_id' => "int(11) NULL COMMENT '店铺id'",
            'create_time' => "datetime NULL",
            'update_time' => "datetime NULL",
            'name' => "varchar(100) NOT NULL COMMENT '包间名'",
            'picture' => "varchar(255) NULL COMMENT '包间图片'",
            'introduce' => "text NULL COMMENT '包间介绍'",
            'max_num' => "int(11) NULL COMMENT '可容纳人数'",
            'tip' => "text NULL COMMENT '包间说明'",
            'status' => "smallint(6) NULL COMMENT '包间状态：1.空闲中 2.待打扫 3.待客中'",
            'set_meal_ids' => "varchar(100) NULL COMMENT '包间套餐列表'",
            'fit_num' => "varchar(100) NULL COMMENT '包间适合人数'",
            'price' => "decimal(10,2) NULL",
            'slide' => "text NULL COMMENT '包间幻灯片'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='包间表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%diandi_tea_hourse}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

